<%@ page language="java" import="java.util.*,news.dao.*,news.pojo.*,news.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>新闻发布系统管理后台</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<style>
a{
text-decoration:none;
}

</style>
<script type="text/javascript">
function souye(){
location='home.jsp';
}
</script>
<%-- <% 	    if(session.getAttribute("uname")==null){
		out.print("<script>location='index.jsp';alert('请先登录！');</script>");
		} %> --%>
		<c:if test="${empty uname }">
		out.print("<script>alert('请先登录！');location='home.jsp';</script>");
		</c:if>
		
<div id="header">
  <div id="welcome">欢迎使用新闻管理系统！</div>
  <div id="nav">
    <div id="logo"><img src="images/logo.jpg" alt="新闻中国" onclick="souye()" /></div>
    <div id="a_b01"><img src="images/a_b01.gif" alt="" /></div>
  </div>
</div>
<div id="admin_bar">
<%-- <%String uname=(String)session.getAttribute("uname");
String upwd=(String)session.getAttribute("upwd");
%> --%>
  <div id="status">管理员：${uname}欢迎您  &#160;&#160;&#160;&#160; <a href="dologoutServlet">退出登录</a>
  &#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; 
  <a href="addnewsServlet?opr=findTopics" style="color:blue ">添加新闻</a>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; 

  &#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; <a href="addtopicsServlet?opr=list">编辑主题</a></div>
  <div id="channel"> </div>
</div>
</head>
<body>

<div id="main">

  <div id="opt_area">    
    <script language="javascript">
	function clickdel(){
		return confirm("删除请点击确认");
	}
	
</script>
	<ul class="class_date">
					<li id='class_month'>
					<c:forEach items="${topics}" var="topic"
							varStatus="s">
							<a href="adminServlet?pageno=${pa.pageno}&tid=${topic.tid}"> <b>${topic.tname}</b></a>
						</c:forEach></li>
				</ul>
    <ul class="classlist">
    <c:forEach items="${pa.p}" var="pnews" varStatus="s">
						  <li><a href='newsServlet?nid=${pnews.nid }'  style="text-decoration:none;color:green">${pnews.ntitle } </a><span> 作者：${pnews.nauthor }
      	    &#160;&#160;&#160;&#160;&#160;&#160;<a href='modifynewsServlet?nid=${pnews.nid }'>修改</a> 
      	    &#160;&#160;&#160;&#160; <a href='deleteNewsServlet?opr=del&delnid=${pnews.nid }' onclick='return clickdel()'
      	    style="color:brown "
      	     >删除</a> </span> </li>    <c:if test="${s.count%5==0}">
								<li class='space'></li>
								
							</c:if>
					</c:forEach>
					<p align="right">
					<c:if test="${pa.pageno>1}">
					<a
							href="adminServlet?pageno=${pa.pageno-1}&tid=${tid}">上一页</a>&#160;
					</c:if>
						<c:if test="${pa.pageno<pa.totalno }">
						<a
							href="adminServlet?pageno=${pa.pageno+1}&tid=${tid}">下一页</a>&#160;
							<a
							href="adminServlet?pageno=${pa.totalno}&tid=${tid}">末页</a>&#160;
						</c:if>
						当前页数:[ ${pa.pageno}/${pa.totalno}]
					</p>
           <%--           
      	    <%
     
      	    Integer pagenumber=1;  
      	    try{
      	    pagenumber=Integer.parseInt(request.getParameter("pageNo"));    	    
      	    }catch(Exception e){}   	    
      	    Page<News> p=NewsDao.nd.search1(pagenumber);
      	    for(int i=0;i<p.getP().size();){
      	    News nq=p.getP().get(i);
      	    
      	    %> 
      	    <li><a href='news.jsp?nid=<%=nq.getNid()%>'  style="text-decoration:none;color:green"><%=nq.getNtitle() %> </a><span> 作者：<%=nq.getNauthor() %>
      	    &#160;&#160;&#160;&#160;&#160;&#160;<a href='modifynews.jsp?nid=<%=nq.getNid()%>'>修改</a> 
      	    &#160;&#160;&#160;&#160; <a href='news_control.jsp?opr=del&delnid=<%=nq.getNid()%>' onclick='return clickdel()'
      	    style="color:brown "
      	     >删除</a> </span> </li>       	        	    
      	    <%  
      	    i++;    	    
      	    if(i%5==0){
      	    out.print("  <li class='space'></li> ");
      	    %>
      	   
      	    <%
      	    
      	    }      	    
      	    }
      	     %>	      	         	
	   			<p align="right"> 
	   			当前页数：[<%=p.getPageno() %>/<%=p.getTotalno() %>]
	   			<%
	   			if(p.getPageno()>1){%>
	   			<a href="admin.jsp?pageNo=<%=p.getPageno()-1%>">上一页</a>   			
	   			<%} %>
	   			<%if(p.getPageno()<p.getTotalno()){ %>
	   			<a href="admin.jsp?pageNo=<%=p.getPageno()+1%>">下一页</a>
	   			<a href="admin.jsp?pageNo=<%=p.getTotalno()%>">末&nbsp 页</a>
	   			<%} %>
--%>
</ul>

  </div>
</div>
<div id="footer">
  <div id="site_link"> <a href="#">关于我们</a><span>|</span> <a href="#">Aboue Us</a><span>|</span> <a href="#">联系我们</a><span>|</span> <a href="#">广告服务</a><span>|</span> <a href="#">供稿服务</a><span>|</span> <a href="#">法律声明</a><span>|</span> <a href="#">招聘信息</a><span>|</span> <a href="#">网站地图</a><span>|</span> <a href="#">留言反馈</a> </div>
<div id="footer">
  <p class="">24小时客户服务热线：010-68988888  &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a> &#160;&#160;&#160;&#160;  新闻热线：010-627488888<br />
    文明办网文明上网举报电话：010-627488888  &#160;&#160;&#160;&#160;  举报邮箱：<a href="#">jubao@jb-aptech.com.cn</a></p>
  <p class="copyright">Copyright &copy; 1999-2009 News China gov, All Right Reserver<br />
    新闻中国   版权所有</p>
</div>
</body>
</html>